﻿using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace mvcdemo.controllers
{
    //标签 
    //java 注解
    [Route("/lin/[controller]/[action]")]
    public class TestController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
        [Route("/api/[controller]/[action]")]
        public IActionResult Myview()
        {

            return View();
        }
        public IActionResult ViewDataDemo()
        {
            ViewData["name"] = "ken";
            ViewData["birthday"] = new DateTime(2000, 1, 1);
            ViewData["hobby"] = new string[] { "跑步", "阅读", "Coding" };
            return View();
        }
        public IActionResult ViewBagDemo()
        {
            ViewBag.name = "张飞";
            ViewBag.date = new DateTime(2022, 09, 24);
            return View();
        }
      
    }
}